<?php

class CustomerCompany extends Eloquent {
	protected $table;
	public $timestamps = false;
	
	/********************************************************************************
	 ******************************** PUBLIC FUNCTIONS ******************************
	 ********************************************************************************/
	
	/**
	 * ses the table for the model
	 */
	public function __construct() {
		$this->table = Helper::getDB ('gastro') . 'customer_company';
	}
	
	
	/**********************************************************************
	 ************************** HAS MANY RELATIONS ************************
	 **********************************************************************/
	
	/**
	 * returns all locations 
	 * @return		array
	 */
	public function locations(){
		return $this->hasMany('Location', 'company_id');
	}
	
	
	/**********************************************************************
	 ************************* BELONGS TO RELATIONS ***********************
	 **********************************************************************/
	
	/**
	 * returns the customer
	 * @return		mixed
	 */
	public function customer(){
		return $this->belongsTo('Customer', 'customer_id');
	}
	
	
	/**
	 * returns the company
	 * @return		mixed
	 */
	public function company(){
		return $this->belongsTo('Company', 'id');
	}
	
	
	/**
	 * returns the logo file 
	 * @return		mixed
	 */
	public function logoFile(){
		return $this->belongsTo('File', 'logo_file_id');
	}

}